package org.hackystat.sdsa.analyzer.model.activity.refactoring;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;

import org.junit.Test;

/**
 * Test refactoring operators.
 *  
 * @author Hongbing Kou
 */
public class TestRefactorOperator {
  /**
   * Tests refactoring operator.
   */
  @Test public void testRefactorOp() {
    RefactorOperator ADD = RefactorOperator.getInstance("ADD");
    RefactorOperator ADD2 = RefactorOperator.getInstance("ADD");
    assertSame("Test ADD singletonness", ADD, ADD2);
    assertSame("Test ADD toString", "ADD", ADD.toString());
    assertTrue("Test ADD operator unary", ADD.isUnary());
    assertFalse("Test ADD operator binary", ADD.isBinary());
    
    RefactorOperator REMOVE = RefactorOperator.getInstance("REMOVE");
    RefactorOperator REMOVE2 = RefactorOperator.getInstance("REMOVE");
    assertSame("Test REMOVE singletonness", REMOVE, REMOVE2);
    assertTrue("Test Remove operator unary", REMOVE.isUnary());
    assertFalse("Test Remove operator binary", REMOVE.isBinary());

    RefactorOperator MOVE = RefactorOperator.getInstance("MOVE");
    RefactorOperator MOVE2 = RefactorOperator.getInstance("MOVE");
    assertSame("Test MOVE singletonness", MOVE, MOVE2);
    assertFalse("Test move operator unary", MOVE.isUnary());
    assertTrue("Test move operator binary", MOVE.isBinary());
    
    RefactorOperator RENAME = RefactorOperator.getInstance("RENAME");
    RefactorOperator RENAME2 = RefactorOperator.getInstance("RENAME");
    assertSame("Test RENAME singletonness", RENAME, RENAME2);
    assertFalse("Test rename operator unary", RENAME.isUnary());
    assertTrue("Test rename operator binary", RENAME.isBinary());
  }
}
